<template>
  <div >
    <div>
      <div class="font15 mt10 pl10">
      <span class="titletext ">{{titledata.title}}</span>
      <div class="graytext  mt10 font13">
        <span >工单编号：</span>
        <span class="titletext">{{titledata.pmInsId}}</span>
      </div>
    </div>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">商机信息</span>
    </div>
    <!-- 基本信息 -->
      <van-field readonly required name="busiOpportunityNumber" :value="fromdata.busiOpportunityNumber" label="全网商机编码：" label-width="7em" />
      <van-field readonly required name="busiOpportunityName" :value="fromdata.busiOpportunityName" label="商机名称：" label-width="5em" />
      <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
        <div class="blue_item" />
        <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">项目基本信息</span>
      </div>
      <van-field readonly required name="groupProjectCode" :value="fromdata.groupProjectCode" label="全网项目编码：" label-width="7em" />
      <van-field readonly name="projectName" :value="fromdata.projectName" label="项目名称：" label-width="5em" autosize rows="1" type="textarea" />
      <van-field readonly required name="projectManagerCode" :value="fromdata.solutionIncentiveInfo.projectManagerCode" label="客户经理姓名：" label-width="7em" />
      <van-field readonly required name="provinceCode" :value="fromdata.solutionIncentiveInfo.provinceCode" label="归属省：" label-width="4em" />
      <van-field readonly required name="cityCode" :value="fromdata.solutionIncentiveInfo.cityCode" label="归属地市：" label-width="5em" />
      <van-field readonly required name="projectManagerPhone" :value="fromdata.solutionIncentiveInfo.projectManagerPhone" label="客户经理手机号码：" label-width="9em" />
      <van-field readonly required name="signingTime" :value="fromdata.solutionIncentiveInfo.signingTime" label="签约时间：" label-width="5em" />
      <van-field readonly required name="contractTerm" :value="fromdata.solutionIncentiveInfo.contractTerm" label="项目年限(年)：" label-width="7.5em" />
      <van-field readonly required name="industrycounty" :value="fromdata.solutionIncentiveInfo.industrycounty" label="所属行业：" label-width="5em"  autosize rows="1" type="textarea"/>
      <van-field readonly required name="netPresentValueRatio" :value="fromdata.solutionIncentiveInfo.netPresentValueRatio" label="净现值率(%)(效益评估)：" label-width="12em" />
      <van-field readonly required name="profitAmount" :value="fromdata.solutionIncentiveInfo.profitAmount" label="项目整体利润金额(含税,元)：" label-width="14em" />
      <van-field readonly required name="profitMargin" :value="fromdata.solutionIncentiveInfo.profitMargin" label="项目整体利润率(%)(效益评估)：" label-width="15em" />
      <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
        <div class="blue_item" />
        <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">三化解决方案信息</span>
      </div>
      <el-table :data="fromdata.solutionIncentiveInfo.solutionInfoList" border style="width: 100%">
        <el-table-column prop="solutionInfoName" label="三化方案名称" width="180"/>
        <el-table-column prop="solutionInfoCode" label="三化方案编码" width="180"/>
      </el-table>
      <van-field readonly required name="provinceCopyProjectFlag" :value="fromdata.solutionIncentiveInfo.provinceCopyProjectFlag=='Y'?'是':'否'" label="是否跨省复制项目：" label-width="9em" />
      <van-field readonly required name="customerCode" :value="fromdata.solutionIncentiveInfo.customerCode" label="全网客户编码：" label-width="7em" />
      <van-field readonly required name="customerName" :value="fromdata.solutionIncentiveInfo.customerName" label="集团客户名称：" label-width="7em"  autosize rows="1" type="textarea"/>
      <dict_type_value :name='"solutionIndustryCounty"' :keyType='"solutionIndustriesCode"' :model='fromdata.solutionIncentiveInfo.solutionIndustryCounty' :label='"三化方案所属行业："' />
      <van-field readonly required name="solutionInfoName" :value="fromdata.solutionIncentiveInfo.solutionInfoName" label="三化解决方案名称：" label-width="9em"  autosize rows="1" type="textarea"/>
      <van-field readonly required name="projectAutoLevel" :value="fromdata.solutionIncentiveInfo.projectAutoLevel" label="项目自主等级：" label-width="7em" />
      <van-field readonly required name="budgetItTfProfitAmount" :value="fromdata.solutionIncentiveInfo.budgetItTfProfitAmount" label="项目IT通服毛利金额(含税,元)：" label-width="14em" />
      <van-field readonly required name="budgetItTfSignAmount" :value="fromdata.solutionIncentiveInfo.budgetItTfSignAmount" label="项目IT通服签约金额(含税,元)：" label-width="14em" />
      <van-field readonly required name="budgetItTfProfitMargin" :value="fromdata.solutionIncentiveInfo.budgetItTfProfitMargin" label="项目IT通服毛利率(%)(效益评估)：" label-width="16em" />
      <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
        <div class="blue_item" />
        <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">申请赛道</span>
      </div>
      <van-field readonly required value="三化激励" label="激励类型：" label-width="5em" />
      <van-field readonly required name="incentiveReceivedYear" :value="fromdata.incentiveReceivedYear" label="获得激励年份：" label-width="7em" />
      <van-field readonly required name="autodromeValue" :value="autodromeValue" label="赛道：" label-width="3em" />
      <historyAndSuggs id='target' :showHistory='showHistory' :historydata='historydata' :approveList='approveList' />
    </div>
  </div>
</template>
 
<script>
import historyAndSuggs from "@/views/srqr/historyAndSuggs.vue";
import {getCountyCode, queryOneDictIndustry, queryTrack} from "@/api/dictapi";
import {Notify} from "vant";
import {mapGetters} from "vuex";
import dict_type_value from "@/components/dict_type_value/index.vue";
export default {
  data() {
    return {
      provinceCode:'',
      cityCode:'',
      publicCountyCode:'',
      industryCategoryValue:'',
      bigBillFillApplyList:[],
      firstCheck:true,
      autodromeValue:'',
    }
  },
  props: ['titledata','businessdata','fromdata','showHistory','historydata','approveList','todotype','showcChengbanView'],
  computed: {
    ...mapGetters(['user']),
  },
  watch: {
    fromdata: {
      handler () { //这是vue的规定写法，当你watch的值发生变化的时候，就会触发这个handler，这是vue内部帮你做的事情
          this.setdata();
      },
      deep: true,  // 可以深度检测到 obj 对象的属性值的变化
      immediate: true //刷新加载  立马触发一次handler
    }
  },
  methods: {
     tomsg () {
      document.getElementById('target').scrollIntoView({ behavior: 'smooth' })
    },
    setdata(){
      queryTrack(Object.assign({ busiOpportunityNumber: this.fromdata.busiOpportunityNumber,
        groupProjectCode: this.fromdata.groupProjectCode,incentiveType: this.fromdata.incentiveType,userName: this.user.userName }))
          .then((result) => {
            if (!result.data) {
              Notify(result.message);
              return;
            }
            for(var i=0;i<result.data.data.length;i++){
              if(this.fromdata.autodrome.includes(result.data.data[i].value)){
                if (this.autodromeValue==''){
                  this.autodromeValue = result.data.data[i].name;
                }else {
                  this.autodromeValue = this.autodromeValue+','+result.data.data[i].name;
                }
              }
            }
          })
      // queryOneDictIndustry(Object.assign({ userName: this.user.userName }))
      //     .then((result) => {
      //       if (!result.data) {
      //         Notify(result.message);
      //         return;
      //       }
      //       for(var i=0;i<result.data.data.length;i++){
      //         if(result.data.data[i].nineMajorindustriesCode==this.fromdata.bigBillFillApply?.industryCategory){
      //           this.industryCategoryValue = result.data.data[i].nineMajorindustriesName;
      //         }
      //       }
      //     })
      // this.bigBillFillApplyList= [this.fromdata.bigBillFillApply]
      // console.log('转换后的数据是',this.bigBillFillApplyList)
    }
  },
  components: {
    dict_type_value,
    historyAndSuggs
  },
}
</script>
 
<style>
.tables.el-table .cell {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
    line-height: 15px;
    padding-left: 5px;
    padding-right: 5px;
}
</style>